#斐波那契迭代器
class Fab:
    def __iter__(self):
        self.low = 1
        self.high = 1
        return self

    def __next__(self):
        x = self.low
        self.low, self.high = self.high, self.low + self.high
        return x

#实例化对象
fab1 = Fab()
myiter = iter(fab1)
x = int(input("请问您要查看多少位斐波那契数列："))
count = 0
#遍历迭代器
for i in myiter:
    if count < x:
        print(i,end="\t")
        count += 1
    else:
        break
